import java.util.Scanner;

public class phone {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("请输入一个四位整数");
        int math=input.nextInt();
        int mathOne=(math/1)%10+5;//个位
        int mathTwo=(math/10)%10+5;//十位
        int mathThree=(math/100)%10+5;//百位
        int mathFour=(math/1000)%10+5;//千位
        //取余数
        mathOne%=10;
        mathTwo%=10;
        mathThree%=10;
        mathFour%=10;
        //换位
        int C=mathFour;
        mathFour=mathOne;
        mathOne=C;

        int A=mathThree;
        mathThree=mathTwo;
        mathTwo=A;

        String result=String.format("%d%d%d%d",mathFour,mathThree,mathTwo,mathOne);
        System.out.println(result);
    }
}
